<template>
  <div class="home">
    <a-layout id="components-layout-demo-custom-trigger">
    <a-layout-sider v-model="collapsed" :trigger="null" collapsible>
      <div class="logo">
        <img src="../assets/LOGO.png"/>
      </div>
      <a-menu theme="dark" 
      mode="inline" 
      :default-selected-keys="['/']"
      @click="onClick">
        <a-menu-item key="/">
          <a-icon type="user" />
          <span>Teachher</span>
        </a-menu-item>
        <a-menu-item key="/student">
          <a-icon type="video-camera" />
          <span>Student</span>
        </a-menu-item>
        <a-menu-item key="/setting">
          <a-icon type="upload" />
          <span>Setting</span>
        </a-menu-item>
      </a-menu>
    </a-layout-sider>
    <a-layout>
      <a-layout-header style="background: #fff; padding: 0">
        <a-icon
          class="trigger"
          :type="collapsed ? 'menu-unfold' : 'menu-fold'"
          @click="() => (collapsed = !collapsed)"
        />
      </a-layout-header>
      <a-layout-content
        :style="{ margin: '24px 16px', padding: '24px', background: '#fff', minHeight: '280px' }"
      >
        <router-view/>
      </a-layout-content>
    </a-layout>
  </a-layout>
  </div>
</template>

<script>
// @ is an alias to /src
export default {
  name: 'Home',
  components: {
    
  },
  data(){
    return{
      collapsed:false,
      columns:[
        {
         title: 'Name',
         dataIndex: 'name',
        //  scopedSlots: { customRender: 'name' },
        },
        {
         title: 'age',
         dataIndex: 'age',
        //  scopedSlots: { customRender: 'name' },
        },
        {
         title: 'time',
         dataIndex: 'time',
        //  scopedSlots: { customRender: 'name' },
        },
        {
         title: 'action',
        //  scopedSlots: { customRender: 'name' },
        }
      ],
      data:[]
    }
  },
  methods:{
    onClick(props){
      console.log(props);
      this.$router.push(props.key);
    }
  },
  mounted(){
    for(let index=0;index<20;index++){
       var temp = {
        name:"1111",
        age:index,
        time:"2020/09/14"
       }
      this.data.push(temp);
    }
  }
}
</script>

<style scoped>
.logo
{
  width: 100%;
  height: 40px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.logo img
{
  width: 40px;
  height: 40px;
}
</style>
